﻿<lib:ToolBoxControl x:Class="MoPlus.SolutionBuilder.WpfClient.UserControls.Diagrams.ToolBoxDiagramControl"
			xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			xmlns:lib="clr-namespace:MoPlus.SolutionBuilder.WpfClient.Library"
			xmlns:uent="clr-namespace:MoPlus.SolutionBuilder.WpfClient.UserControls.Entities"
			xmlns:vm="clr-namespace:MoPlus.ViewModel;assembly=MoPlus.ViewModel"
			xmlns:svm="clr-namespace:MoPlus.ViewModel.Solutions;assembly=MoPlus.ViewModel"
			xmlns:evm="clr-namespace:MoPlus.ViewModel.Entities;assembly=MoPlus.ViewModel"
			xmlns:wvm="clr-namespace:MoPlus.ViewModel.Workflows;assembly=MoPlus.ViewModel"
            xmlns:Settings="clr-namespace:MoPlus.SolutionBuilder.WpfClient.Library;assembly=MoPlus.SolutionBuilder.WpfClient"
			mc:Ignorable="d" 
			d:DesignHeight="300" d:DesignWidth="300">
	<lib:ToolBoxControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../../Resources/Theme.xaml" />
			</ResourceDictionary.MergedDictionaries>
			<vm:LabelHelper x:Key="labels" />
			<Style x:Key="DiagramNameInput" BasedOn="{StaticResource LabelInput}" TargetType="{x:Type Label}">
				<Style.Triggers>
					<DataTrigger Binding="{Binding DiagramNameCustomized, Mode=OneWay}" Value="True">
						<DataTrigger.Setters>
							<Setter Property="Foreground" Value="Black" />
						</DataTrigger.Setters>
					</DataTrigger>
					<DataTrigger Binding="{Binding DiagramNameValidationMessage, Converter={StaticResource IsNullOrEmptyConverter}, Mode=OneWay}" Value="False">
						<DataTrigger.Setters>
							<Setter Property="Foreground" Value="Red" />
						</DataTrigger.Setters>
					</DataTrigger>
				</Style.Triggers>
			</Style>
			<Style x:Key="DescriptionInput" BasedOn="{StaticResource LabelInput}" TargetType="{x:Type Label}">
				<Style.Triggers>
					<DataTrigger Binding="{Binding DescriptionCustomized, Mode=OneWay}" Value="True">
						<DataTrigger.Setters>
							<Setter Property="Foreground" Value="Black" />
						</DataTrigger.Setters>
					</DataTrigger>
					<DataTrigger Binding="{Binding DescriptionValidationMessage, Converter={StaticResource IsNullOrEmptyConverter}, Mode=OneWay}" Value="False">
						<DataTrigger.Setters>
							<Setter Property="Foreground" Value="Red" />
						</DataTrigger.Setters>
					</DataTrigger>
				</Style.Triggers>
			</Style>
		</ResourceDictionary>
	</lib:ToolBoxControl.Resources>
	<Grid>
		<Grid.LayoutTransform>
			<TransformGroup>
				<ScaleTransform ScaleX="{Binding Source={x:Static Settings:UserSettingsHelper.Instance}, Path=ControlSize, Mode=TwoWay}"
					                          ScaleY="{Binding Source={x:Static Settings:UserSettingsHelper.Instance}, Path=ControlSize, Mode=TwoWay}"/>
			</TransformGroup>
		</Grid.LayoutTransform>
		<!-- Diagram Window -->
		<Expander Header="{Binding Source={StaticResource labels}, Path=DiagramToolBoxHeader}" IsExpanded="True">
			<Grid MinWidth="200" MinHeight="200">
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"></RowDefinition>
					<RowDefinition Height="Auto" ></RowDefinition>
					<RowDefinition Height="Auto"></RowDefinition>
					<RowDefinition Height="Auto"></RowDefinition>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="10"></ColumnDefinition>
					<ColumnDefinition Width="Auto"></ColumnDefinition>
					<ColumnDefinition Width="*"></ColumnDefinition>
					<ColumnDefinition Width="10"></ColumnDefinition>
				</Grid.ColumnDefinitions>
				<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Style="{StaticResource LabelHeader}" Content="{Binding Title, Mode=OneWay}" />
				<Label Grid.Row="1" Grid.Column="1" Style="{StaticResource DiagramNameInput}" Content="{Binding DiagramNameLabel, Mode=OneWay}" />
				<Label Grid.Row="2" Grid.Column="1" Style="{StaticResource DescriptionInput}" Content="{Binding DescriptionLabel, Mode=OneWay}" />
				<TextBox Grid.Row="1" Grid.Column="2" ToolTip="{Binding DiagramNameValidationMessage, Mode=OneWay}" Text="{Binding DiagramName, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" MaxLength="255" Validation.ErrorTemplate="{x:Null}" Loaded="TextBox_Loaded" />
				<Border Name="PlaceHolderBorder" Grid.Column="2" Margin="7"/>
				<TextBox Grid.Row="2" Grid.Column="2" ToolTip="{Binding DescriptionValidationMessage, Mode=OneWay}" Text="{Binding Description, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" VerticalScrollBarVisibility="Auto" TextAlignment="Left" TextWrapping="Wrap" Width="{Binding ElementName=PlaceHolderBorder, Path=ActualWidth}" Height="120" MaxLength="2000" Validation.ErrorTemplate="{x:Null}" />
				<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="2" Margin="5">
					<Button Command="{Binding UpdateCommand}" Content="{Binding UpdateButtonLabel}"></Button>
					<Button Command="{Binding ResetCommand}" Content="{Binding ResetButtonLabel}"></Button>
					<Button Command="{Binding DefaultsCommand}" Content="{Binding DefaultsButtonLabel}"></Button>
					<Button Command="{Binding CloseConfirmCommand}" Content="{Binding CloseButtonLabel}"></Button>
				</StackPanel>
			</Grid>
		</Expander>
	</Grid>
</lib:ToolBoxControl>
